package com.mtsmda.jpa.run;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

import com.mtsmda.jpa.domain.enumStore.FootbalPlayer;
import com.mtsmda.jpa.domain.enumStore.Position;

public class EnumDemoRun {

	public static void main(String[] args) {
		EntityManager entityManager = Persistence.createEntityManagerFactory(
				"MTSMDA").createEntityManager();
		entityManager.getTransaction().begin();

		FootbalPlayer footbalPlayerMessi = new FootbalPlayer("Messi", "Leo",
				Position.AM);
		FootbalPlayer footbalPlayerRonaldo = new FootbalPlayer("Ronaldo",
				"Cristiano", Position.AM);

		entityManager.persist(footbalPlayerMessi);
		entityManager.persist(footbalPlayerRonaldo);

		entityManager.getTransaction().commit();
		entityManager.close();
	}

}